package cn.getech.data.development.controller;

import cn.getech.data.development.constant.DataDevelopmentBizExceptionEnum;
import cn.getech.data.development.constant.YesOrNoEnum;
import cn.getech.data.development.dto.*;
import cn.getech.data.development.entity.JobNodeConf;
import cn.getech.data.development.entity.WorkMenu;
import cn.getech.data.development.model.dto.*;
import cn.getech.data.development.model.vo.*;
import cn.getech.data.development.service.IWorkMenuService;
import cn.getech.data.development.service.ProcUserService;
import cn.getech.data.intelligence.common.exception.RRException;
import cn.getech.data.intelligence.common.utils.PageUtils;
import cn.getech.data.intelligence.common.utils.PojoUtils;
import cn.getech.data.intelligence.common.utils.R;
import cn.getech.system.center.annotation.SysLog;
import cn.getech.system.center.constant.OperationModulesEnum;
import cn.getech.system.center.constant.OperationTypeEnum;
import cn.getech.system.center.constant.module.ModuleEnum;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import io.swagger.annotations.ApiOperation;
import jodd.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;

import java.util.*;
import java.util.stream.Collectors;

/**
 * <p>
 * 作业流菜单树 前端控制器
 * </p>
 *
 * @author hujz
 * @since 2020-04-13
 */
@Slf4j
@RestController
@RequestMapping("/bdp/workMenu")
public class WorkMenuController {

    @Autowired
    private IWorkMenuService iWorkMenuService;
    @Autowired
    private ProcUserService procUserService;
    private static Map<Long, Integer> uniqueMap = Maps.newHashMap();//防止重复点击运行

    @ApiOperation("获取工作流菜单树")
    @GetMapping("/getSeeWorkFlowMenues/{procId}")
    public R getSeeWorkFlowMenues(@PathVariable(value = "procId") Integer procId) {
        List<WorkMenuDto> workMenuDtos = iWorkMenuService.listSeeWorkFlowMenues(procId);
        return R.okWithData(workMenuDtos);
    }

    @ApiOperation("获取工作流菜单树")
    @GetMapping("/getWorkFlowMenues/{procId}")
    //@SysLog(value="获取工作流菜单树",type= OperationTypeEnum.SELECTCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //todo 0925
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R getWorkFlowMenues(@PathVariable(value = "procId") Integer procId) {
        List<WorkMenuDto> workMenuDtos = iWorkMenuService.listWorkFlowMenues(procId);
        return R.okWithData(workMenuDtos);
    }

    @ApiOperation("获取任务的sql")
    @GetMapping("/taskSqls")
    public R taskSqls(@RequestParam(required = false) Integer tenantId) {
        //获取租户下的sql
        List<WorkSqlVO> tasks = iWorkMenuService.taskSqls(tenantId);
        return R.okWithData(tasks);
    }



    @ApiOperation("通过用户id，获取工作流菜单树")
    @GetMapping("/getWorkFlowMenusByUserId")
    public R getWorkFlowMenusByUserId(@RequestParam(value = "procId") Integer procId,@RequestParam(value = "userId",required = false) Long userId) {
        List<WorkMenuDto> workMenuDtos = iWorkMenuService.getWorkFlowMenusByUserId(procId,userId);
        return R.okWithData(workMenuDtos);
    }



    @ApiOperation("获取工作流菜单树(只有工作流文件夹)")
    @GetMapping("/getWorkFlows/{procId}")
    //@SysLog(value="获取工作流菜单树",type= OperationTypeEnum.SELECTCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    public R getWorkFlows(@PathVariable(value = "procId") Integer procId) {
        List<WorkMenuDto> workMenuDtos = iWorkMenuService.listWorkFlows(procId);
        return R.okWithData(workMenuDtos);
    }

    @ApiOperation("获取工作流菜单列表")
    @GetMapping("/getWorkFlowMenus")
    //@SysLog(value="获取工作流菜单列表",type= OperationTypeEnum.SELECTCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    public R getWorkFlowMenus(@RequestParam Map<String, Object> params) {
        params.put("sidx", "id");
        params.put("order", "desc");
        params.put("workType", 3);
        PageUtils page = iWorkMenuService.getWorkFlowMenus(params);
        return R.okWithPage(page);
    }


    @ApiOperation("获取工作流依赖菜单列表")
    @GetMapping("/getWorkFlowDepMenus")
    //@SysLog(value="获取工作流依赖菜单列表",type= OperationTypeEnum.SELECTCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    public R getWorkFlowDepMenus(@RequestParam Map<String, Object> params) {
        params.put("sidx", "id");
        params.put("order", "desc");
        params.put("workType", 4);
        PageUtils page = iWorkMenuService.getWorkFlowMenus(params);
        return R.okWithPage(page);
    }

    @ApiOperation("修改工作流和工作流依赖的系统参数的配置的数据结构")
    @GetMapping("/runSysparams")
    @SysLog(value="修改工作流和工作流依赖的系统参数的配置的数据结构",type= OperationTypeEnum.UPDATECODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    public R updateInitWorkflowNodeParams() {
        Map<String,JSONObject> dddd = iWorkMenuService.updateInitWorkflowNodeParams();
        return R.okWithData(dddd);
    }


//    @PostMapping("/runSysparams")
//    public R updateInitWorkflowNodeParams(@RequestParam(value = "file") MultipartFile multipartFile,@RequestParam("jobNodeId") String jobNodeId) {
//        try {
//            File changeFile = FileUtils.multipartFileToFile(multipartFile);
//            String ttt = jobNodeInfoService.llll(changeFile);
//            System.out.println(ttt);
//            System.out.println(jobNodeId);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        return R.okWithData(null);
//    }

    @ApiOperation("初始化手动作业流依赖的开始节点的shell")
    @GetMapping("/initJobLayStartShell")
    @SysLog(value="初始化手动作业流依赖的开始节点的shell",type= OperationTypeEnum.UPDATECODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    public R initJobLayStartShell() {
        List<Integer> notSuccesslistAllWorkDepList = iWorkMenuService.initJobLayStartShell();
        return R.okWithData(notSuccesslistAllWorkDepList);
    }

    @ApiOperation("初始化自动作业流依赖的开始节点的shell")
    @GetMapping("/initJobLayStartAutoShell")
    @SysLog(value="初始化自动作业流依赖的开始节点的shell",type= OperationTypeEnum.UPDATECODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    public R initJobLayStartAutoShell() {
        Map<String,List<Integer>> notSuccesslistAllWorkDepList = iWorkMenuService.initJobLayStartAutoShell();
        return R.okWithData(notSuccesslistAllWorkDepList);
    }


    @ApiOperation("新增下级目录")
    @PostMapping("/addsubWorkFlowMenu")
    @SysLog(value="新增下级目录/作业流依赖",type= OperationTypeEnum.ADDCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //todo 0925
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R addsubWorkFlowMenu(@RequestBody WorkMenuVO workMenuVO) {
        Assert.notNull(workMenuVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        WorkMenuDto workMenuDto = new WorkMenuDto();
        BeanUtils.copyProperties(workMenuVO, workMenuDto);
        WorkMenu workMenu = iWorkMenuService.addsubWorkFlowMenu(workMenuDto);
        Map<String,Object> result = new HashMap<>();
        result.put("id",workMenu.getId());
        result.put("workflowType",0);
        return R.okWithData(result);
    }

    @ApiOperation("新增默认作业流")
    @PostMapping("/addDefaultWorkFlowMenu")
    @SysLog(value="新增作业流",type= OperationTypeEnum.ADDCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //todo 0925
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R addDefaultWorkFlowMenu(@RequestBody WorkMenuVO workMenuVO) {
        Assert.notNull(workMenuVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        WorkMenuDto workMenuDto = new WorkMenuDto();
        BeanUtils.copyProperties(workMenuVO, workMenuDto);
        WorkMenu workMenu= iWorkMenuService.addDefaultWorkFlowMenu(workMenuDto);
        Map<String,Object> result = new HashMap<>();
        result.put("id",workMenu.getId());
        result.put("workflowType",0);
        return R.okWithData(result);
    }

    @ApiOperation("新增根目录")
    @PostMapping("/addWorkFlowMenu")
    @SysLog(value="新增根目录",type= OperationTypeEnum.ADDCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //todo 0925
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R addWorkFlowMenu(@RequestBody WorkMenuVO workMenuVO) {
        Assert.notNull(workMenuVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        WorkMenuDto workMenuDto = new WorkMenuDto();
        String name=workMenuVO.getName();
        if(StringUtil.isBlank(name) || StrUtil.totalLength(name)>200){
            throw new RRException("名称不能为空或超过200个字符,请重新输入");
        }
        BeanUtils.copyProperties(workMenuVO, workMenuDto);
        WorkMenu workMenu = iWorkMenuService.addWorkFlowMenu(workMenuDto);
        Map<String,Object> result = new HashMap<>();
        result.put("id",workMenu.getId());
        result.put("workflowType",0);
        return R.okWithData(result);
    }

    @ApiOperation("重命名节点任务")
    @PostMapping("/updateWorkFlowName")
    @SysLog(value="重命名任务节点",type= OperationTypeEnum.UPDATECODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    public R updateWorkFlowName(@RequestBody WorkMenuVO workMenuVO) {
        Assert.notNull(workMenuVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        WorkMenuDto workMenuDto = new WorkMenuDto();
        BeanUtils.copyProperties(workMenuVO, workMenuDto);
        iWorkMenuService.updateWorkFlowName(workMenuDto);
        return R.ok();
    }

    @ApiOperation("编辑shell任务")
    @PostMapping("/updateShellJob")
    @SysLog(value="编辑shell任务",type= OperationTypeEnum.UPDATECODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    public R updateShellJob(@RequestBody WorkMenuVO workMenuVO) {
        Assert.notNull(workMenuVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        WorkMenuDto workMenuDto = new WorkMenuDto();
        BeanUtils.copyProperties(workMenuVO, workMenuDto);
        iWorkMenuService.updateShellJob(workMenuDto);
        return R.ok();
    }

    @ApiOperation("重命名菜单树")
    @PostMapping("/updateWorkFlowMenuName")
    @SysLog(value="重命名作业流（依赖）",type= OperationTypeEnum.UPDATECODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //todo 0925
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R updateWorkFlowMenuName(@RequestBody WorkMenuVO workMenuVO) {
        Assert.notNull(workMenuVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        WorkMenuDto workMenuDto = new WorkMenuDto();
        BeanUtils.copyProperties(workMenuVO, workMenuDto);
        iWorkMenuService.updateWorkFlowMenuName(workMenuDto);
        return R.ok();
    }

    @ApiOperation("删除目录菜单")
    @PostMapping("/delWorkFlowMenu")
    @SysLog(value="删除目录/作业流（依赖）",type= OperationTypeEnum.DELETECODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //todo 0925
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R delWorkFlowMenu(@RequestBody WorkMenuVO workMenuVO) throws Exception {
        Assert.notNull(workMenuVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        WorkMenuDto workMenuDto = new WorkMenuDto();
        BeanUtils.copyProperties(workMenuVO, workMenuDto);
        iWorkMenuService.delWorkFlowMenu(workMenuDto);
        return R.ok();
    }

    @ApiOperation("删除任务节点")
    @PostMapping("/delWorkFlow")
    @SysLog(value="删除任务节点",type= OperationTypeEnum.DELETECODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //todo 0925
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R delWorkFlow(@RequestBody WorkMenuVO workMenuVO) {
        Assert.notNull(workMenuVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        WorkMenuDto workMenuDto = new WorkMenuDto();
        BeanUtils.copyProperties(workMenuVO, workMenuDto);
        iWorkMenuService.delWorkFlow(workMenuDto);
        return R.ok();
    }


    @ApiOperation("编辑保存作业流依赖")
    @PostMapping("/updateWorkFlow")
    @SysLog(value="编辑保存作业流依赖",type= OperationTypeEnum.UPDATECODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //todo 0925
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R updateWorkFlow(@RequestBody JobLinkAndJobVO jobLinkAndJobVO) {
        Assert.notNull(jobLinkAndJobVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        JobLinkAndJobDto jobLinkAndJobDto = new JobLinkAndJobDto();
        BeanUtils.copyProperties(jobLinkAndJobVO, jobLinkAndJobDto);
        jobLinkAndJobDto.setEdges(PojoUtils.listConvert(JobLinkDto.class, jobLinkAndJobVO.getEdges()));
        jobLinkAndJobDto.setNodes(PojoUtils.listConvert(JobInfoDto.class, jobLinkAndJobVO.getNodes()));
        iWorkMenuService.updateWorkFlow(jobLinkAndJobDto, Boolean.TRUE);
        return R.ok();
    }


    @ApiOperation("新增任务")
    @PostMapping("/addWorkJob")
    @SysLog(value="新增任务",type= OperationTypeEnum.ADDCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //todo 0925
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R addWorkJob(@RequestBody WorkMenuVO workMenuVO) {
        Assert.notNull(workMenuVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        WorkMenuDto workMenuDto = new WorkMenuDto();
        BeanUtils.copyProperties(workMenuVO, workMenuDto);
        Map<String,Object> result = new HashMap<>();
        Integer jobNodeId = iWorkMenuService.addWorkJob(workMenuDto);
        result.put("id",jobNodeId);
        result.put("workflowType",1);
        return R.okWithData(result);
    }

    @ApiOperation("编辑保存任务工作流")
    @PostMapping("/updateWorkJob")
    @SysLog(value="编辑保存任务工作流",type= OperationTypeEnum.UPDATECODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //todo 0925
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R updateWorkJob(@RequestBody JobLinkAndJobNodeVO jobLinkAndJobNodeVO) {
        Assert.notNull(jobLinkAndJobNodeVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        JobLinkAndJobNodeDto jobLinkAndJobNodeDto = new JobLinkAndJobNodeDto();
        BeanUtils.copyProperties(jobLinkAndJobNodeVO, jobLinkAndJobNodeDto);
        jobLinkAndJobNodeDto.setEdges(PojoUtils.listConvert(JobLinkDto.class, jobLinkAndJobNodeVO.getEdges()));
        jobLinkAndJobNodeDto.setNodes(PojoUtils.listConvert(JobNodeInfoDto.class, jobLinkAndJobNodeVO.getNodes()));
        iWorkMenuService.updateWorkJob(jobLinkAndJobNodeDto);
        return R.ok();
    }

    @ApiOperation("运行任务工作流")
    @PostMapping("/runWorkJob/{jobMenuId}")
    @SysLog(value="运行任务工作流",type= OperationTypeEnum.RUNCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //todo 0925
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R runWorkJob(@PathVariable("jobMenuId") Long jobMenuId) {
        //验证是否是当前项目关联的人员
        Integer procId = iWorkMenuService.getProIdByMenuId(jobMenuId);
        if(!procUserService.checkViewPermission(procId)){
            throw new RRException(DataDevelopmentBizExceptionEnum.PROCINFO_PERMISSIOIN.getMessage());
        }
        if (uniqueMap.containsKey(jobMenuId)) {
            //防止重复提交
            throw new RRException("当前工作流正在准备中，请稍后尝试！");
        }
        uniqueMap.put(jobMenuId, YesOrNoEnum.YES.getValue());
        try {
            iWorkMenuService.runWorkJob(jobMenuId);
        }catch (Exception e){
            throw new RRException(e.getMessage());
        }finally {
            uniqueMap.remove(jobMenuId);
        }
        return R.ok();
    }

    @ApiOperation("暂停任务工作流")
    @PostMapping("/stopWorkJob/{jobMenuId}")
    @SysLog(value="暂停任务工作流",type= OperationTypeEnum.STOPCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //todo 0925
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R stopWorkJob(@PathVariable("jobMenuId") Long jobMenuId) {
        //验证是否是当前项目关联的人员
        Integer procId = iWorkMenuService.getProIdByMenuId(jobMenuId);
        if(!procUserService.checkViewPermission(procId)){
            throw new RRException(DataDevelopmentBizExceptionEnum.PROCINFO_PERMISSIOIN.getMessage());
        }
        iWorkMenuService.stopCurrentWorkJob(jobMenuId);
        return R.ok();
    }

    @ApiOperation("运行任务工作流依赖")
    @PostMapping("/runWorkFlowJob/{jobWorkMenuId}")
    @SysLog(value="运行任务工作流依赖",type= OperationTypeEnum.RUNCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //todo 0925
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R runWorkFlowJob(@PathVariable("jobWorkMenuId") Long jobWorkMenuId) {
        //验证是否是当前项目关联的人员
        Integer procId = iWorkMenuService.getProIdByMenuId(jobWorkMenuId);
        if(!procUserService.checkViewPermission(procId)){
            throw new RRException(DataDevelopmentBizExceptionEnum.PROCINFO_PERMISSIOIN.getMessage());
        }
        if (uniqueMap.containsKey(jobWorkMenuId)) {
            //防止重复提交
            throw new RRException("当前工作流依赖正在准备中，请稍后尝试！");
        }
        uniqueMap.put(jobWorkMenuId, YesOrNoEnum.YES.getValue());
        try {
            iWorkMenuService.runWorkFlowJob(jobWorkMenuId);
        }catch (Exception e){
            throw new RRException(e.getMessage());
        }finally {
            uniqueMap.remove(jobWorkMenuId);
        }
        return R.ok();
    }


    @ApiOperation("禁用任务工作流依赖")
    @PostMapping("/closeWorkFlowJob/{jobWorkMenuId}")
    @SysLog(value="禁用任务工作流依赖",type= OperationTypeEnum.OPENCLOSECODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //todo 0925
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R closeWorkFlowJob(@PathVariable("jobWorkMenuId") Long jobWorkMenuId) {
        //验证是否是当前项目关联的人员
        Integer procId = iWorkMenuService.getProIdByMenuId(jobWorkMenuId);
        if(!procUserService.checkViewPermission(procId)){
            throw new RRException(DataDevelopmentBizExceptionEnum.PROCINFO_PERMISSIOIN.getMessage());
        }
        iWorkMenuService.closeWorkFlowJob(jobWorkMenuId);
        return R.ok();
    }

    @ApiOperation("启用任务工作流依赖")
    @PostMapping("/openWorkFlowJob/{jobWorkMenuId}")
    @SysLog(value="启用任务工作流依赖",type= OperationTypeEnum.OPENCLOSECODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //todo 0925
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R openWorkFlowJob(@PathVariable("jobWorkMenuId") Long jobWorkMenuId) {
        //验证是否是当前项目关联的人员
        Integer procId = iWorkMenuService.getProIdByMenuId(jobWorkMenuId);
        if(!procUserService.checkViewPermission(procId)){
            throw new RRException(DataDevelopmentBizExceptionEnum.PROCINFO_PERMISSIOIN.getMessage());
        }
        iWorkMenuService.openWorkFlowJob(jobWorkMenuId);
        return R.ok();
    }

    @ApiOperation("获取全局配置和对应的菜单的调度配置")
    @GetMapping("/listWorkFlowConfig/{id}")
    //@SysLog(value="获取全局配置和对应的菜单的调度配置",type= OperationTypeEnum.SELECTCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    public R listWorkFlowConfig(@PathVariable("id") Long id) {
        List<JobNodeConf> jobNodeConfs = iWorkMenuService.listWorkFlowConfig(id);
        if (CollectionUtil.isNotEmpty(jobNodeConfs)) {
            Set<String> keys = new HashSet<>();
            for (JobNodeConf jobNodeConf : jobNodeConfs) {
                //得到这个节点的数据结构，并且并且重新赋值
                if ("nodeParam".equals(jobNodeConf.getKey())) {
                    if (null != jobNodeConf.getValue()) {
                        JSONArray jsonArray = JSONArray.parseArray(jobNodeConf.getValue());
                        jobNodeConf.setValue(JSONArray.toJSONString(jsonArray));
                    }
                }
                if ("sysParam".equals(jobNodeConf.getKey())) {
                    if (null != jobNodeConf.getValue()) {
                        JSONArray jsonArray = JSONArray.parseArray(jobNodeConf.getValue());
                        jobNodeConf.setValue(JSONArray.toJSONString(jsonArray));
                    }
                }
                keys.add(jobNodeConf.getKey());
            }
            if(!keys.contains("cronType")){
                //初始化一个类型
                JobNodeConf newJConf = new JobNodeConf();
                newJConf.setKey("cronType");
                newJConf.setValue("1");
                newJConf.setJobNodeId(id.intValue());
                newJConf.setJobType(1);
                jobNodeConfs.add(newJConf);
            }
        }
        return R.okWithData(jobNodeConfs);
    }

    @ApiOperation("打开工作流依赖")
    @GetMapping("/openWorkFlowMenu")
    @SysLog(value="打开工作流依赖",type= OperationTypeEnum.SELECTCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    public R openWorkFlowMenu(WorkMenuVO workMenuVO) {
        Assert.notNull(workMenuVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        WorkMenuDto workMenuDto = new WorkMenuDto();
        BeanUtils.copyProperties(workMenuVO, workMenuDto);
        List<JobInfoDto> retJobInfoList = iWorkMenuService.listJobList(workMenuDto);
        List<JobLinkDto> retJobLinkList = iWorkMenuService.listJobLinkList(workMenuDto, 1);
        WorkFlowDepDto workFlowDepDto = iWorkMenuService.selectWorkFlowDep(workMenuDto);
        WorkFlowDepVO workFlowDepVO = new WorkFlowDepVO();
        if (null != workFlowDepDto) {
            BeanUtils.copyProperties(workFlowDepDto, workFlowDepVO);
            WorkMenu workMenu = iWorkMenuService.getById(workMenuVO.getId());
            if (null != workMenu) {
                workFlowDepVO.setName(workMenu.getName());
            }
        }
        JobLinkAndJobVO jobLinkAndJobVO = new JobLinkAndJobVO();
        jobLinkAndJobVO.setWorkFlowMenuId(workMenuVO.getId());
        jobLinkAndJobVO.setEdges(PojoUtils.listConvert(JobLinkVO.class, retJobLinkList));
        jobLinkAndJobVO.setNodes(PojoUtils.listConvert(JobInfoVO.class, retJobInfoList));
        jobLinkAndJobVO.setWorkFlowDepInfo(workFlowDepVO);
        return R.okWithData(jobLinkAndJobVO);
    }

    @ApiOperation("打开工作流")
    @GetMapping("/openWorkFlow")
    @SysLog(value="打开工作流",type= OperationTypeEnum.SELECTCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    public R openWorkFlow(WorkMenuVO workMenuVO) {
        Assert.notNull(workMenuVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        WorkMenuDto workMenuDto = new WorkMenuDto();
        BeanUtils.copyProperties(workMenuVO, workMenuDto);
        List<JobNodeInfoDto> retJobNodeInfoList = iWorkMenuService.listJobNodeList(workMenuDto);
        List<JobLinkDto> retJobLinkList = iWorkMenuService.listJobLinkList(workMenuDto, 0);
        //判断某个节点是否是有上下游节点
        if(CollectionUtil.isNotEmpty(retJobLinkList) && CollectionUtil.isNotEmpty(retJobNodeInfoList)){
            for (JobNodeInfoDto jobNodeInfoDto : retJobNodeInfoList) {
                List<JobLinkDto> downs = retJobLinkList.stream().filter(o -> Objects.equals(o.getSrcNodeId(), jobNodeInfoDto.getId())).collect(Collectors.toList());
                List<JobLinkDto> ups = retJobLinkList.stream().filter(o -> Objects.equals(o.getDstNodeId(), jobNodeInfoDto.getId())).collect(Collectors.toList());
                if(CollectionUtil.isNotEmpty(downs)){
                    jobNodeInfoDto.setIsDown(1);
                }
                if(CollectionUtil.isNotEmpty(ups)){
                    jobNodeInfoDto.setIsUp(1);
                }
            }
        }
        JobInfoDto jobInfoDto = iWorkMenuService.getJobInfo(workMenuDto);
        iWorkMenuService.pushWebData(workMenuVO.getId(),jobInfoDto,retJobNodeInfoList);
        JobInfoVO jobInfoVO = new JobInfoVO();
        if (null != jobInfoDto) {
            BeanUtils.copyProperties(jobInfoDto, jobInfoVO);
        }
        JobLinkAndJobNodeVO jobLinkAndJobNodeVO = new JobLinkAndJobNodeVO();
        jobLinkAndJobNodeVO.setWorkFlowMenuId(workMenuVO.getId());
        jobLinkAndJobNodeVO.setEdges(PojoUtils.listConvert(JobLinkVO.class, retJobLinkList));
        jobLinkAndJobNodeVO.setNodes(PojoUtils.listConvert(JobNodeInfoVO.class, retJobNodeInfoList));
        jobLinkAndJobNodeVO.setJobInfo(jobInfoVO);
        return R.okWithData(jobLinkAndJobNodeVO);

    }

    @ApiOperation("复制保存任务")
    @PostMapping("/copyWorkJob")
    @SysLog(value="复制保存任务",type= OperationTypeEnum.ADDCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //todo 0925
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R copyWorkJob(@RequestBody WorkMenusVO workMenusVO) {
        Assert.notNull(workMenusVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        WorkMenuDto workMenuDto = new WorkMenuDto();
        BeanUtils.copyProperties(workMenusVO, workMenuDto);
        iWorkMenuService.copyWorkJob(workMenuDto);
        return R.ok();
    }

    @ApiOperation("复制出来一个虚拟的节点任务(不需要日志)")
    @GetMapping("/copyVirJobNode/{jobNodeId}")
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R copyVirJobNode(@PathVariable("jobNodeId") Integer jobNodeId) {
        Integer newJobNodeId = iWorkMenuService.copyVirJobNode(jobNodeId);
        return R.okWithData(newJobNodeId);
    }

    @ApiOperation("删除复制出来一个虚拟的节点任务(不需要日志)")
    @PostMapping("/deleteVirJobNode/{jobNodeId}")
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R deleteVirJobNode(@PathVariable("jobNodeId") Integer jobNodeId) {
        iWorkMenuService.deleteVirJobNode(jobNodeId);
        return R.ok();
    }

    @ApiOperation("重跑当前节点")
    @PostMapping("/runNodeJob")
    @SysLog(value="重跑当前节点",type= OperationTypeEnum.RUNCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    public R runNodeJob(@RequestBody WorkMenusVO workMenusVO) {
        Assert.notNull(workMenusVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        WorkMenuDto workMenuDto = new WorkMenuDto();
        BeanUtils.copyProperties(workMenusVO, workMenuDto);
        iWorkMenuService.runNodeJob(workMenuDto);
        return R.ok();
    }

    @ApiOperation("重跑上游")
    @PostMapping("/runUpJob")
    @SysLog(value="重跑上游",type= OperationTypeEnum.RUNCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    public R runUpJob(@RequestBody WorkMenusVO workMenusVO) {
        Assert.notNull(workMenusVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        WorkMenuDto workMenuDto = new WorkMenuDto();
        BeanUtils.copyProperties(workMenusVO, workMenuDto);
        iWorkMenuService.runUpJob(workMenuDto);
        return R.ok();
    }

    @ApiOperation("重跑下游")
    @PostMapping("/runDownJob")
    @SysLog(value="重跑下游",type= OperationTypeEnum.RUNCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    public R runDownJob(@RequestBody WorkMenusVO workMenusVO) {
        Assert.notNull(workMenusVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
        WorkMenuDto workMenuDto = new WorkMenuDto();
        BeanUtils.copyProperties(workMenusVO, workMenuDto);
        iWorkMenuService.runDownJob(workMenuDto);
        return R.ok();
    }


    @ApiOperation("获取该用户下每个项目的工作流树")
    @GetMapping("/getProjectWorkFlowMenues")
    //@SysLog(value="获取该用户下每个项目的工作流树",type= OperationTypeEnum.SELECTCODE, modulesType = OperationModulesEnum.BDPMODELCODE,platformModuleType = ModuleEnum.PROJECT_LIST_MODULE_CODE)
    //@RequiresPermissions({"bdp:procInfo:develop"})
    public R getProjectWorkFlowMenues() {
        List<WorkMenuDto> workMenuDtos = iWorkMenuService.getProjectWorkFlowMenues();
        return R.okWithData(workMenuDtos);
    }

//
//    @ApiOperation("一键平整")
//    @GetMapping("/reGenerageWorkFlow")
//    public R reGenerageWorkFlow(WorkMenuVO workMenuVO) {
//        Assert.notNull(workMenuVO, DataDevelopmentBizExceptionEnum.PARAM_ERROR.getMessage());
//        WorkMenuDto workMenuDto = new WorkMenuDto();
//        BeanUtils.copyProperties(workMenuVO, workMenuDto);
//
//        List<JobNodeInfoDto> retJobNodeInfoList = iWorkMenuService.listJobNodeList(workMenuDto);
//        List<JobLinkDto> retJobLinkList = iWorkMenuService.listJobLinkList(workMenuDto, 0);
//        JobInfoDto jobInfoDto = iWorkMenuService.getJobInfo(workMenuDto);
//        JobInfoVO jobInfoVO = new JobInfoVO();
//        if (null != jobInfoDto) {
//            BeanUtils.copyProperties(jobInfoDto, jobInfoVO);
//        }
//
//        List<JobLinkVO> edges = PojoUtils.listConvert(JobLinkVO.class, retJobLinkList);
//        List<JobNodeInfoVO> nodes = PojoUtils.listConvert(JobNodeInfoVO.class, retJobNodeInfoList);
//
//        JobLinkAndJobNodeVO jobLinkAndJobNodeVO = new JobLinkAndJobNodeVO();
//        jobLinkAndJobNodeVO.setWorkFlowMenuId(workMenuVO.getId());
//        jobLinkAndJobNodeVO.setJobInfo(jobInfoVO);
//        jobLinkAndJobNodeVO.setEdges(edges);
//        List<List<JobNodeInfoVO>> nodeFloor;
//
//        List<JobNodeInfoVO> rePoNodes = new ArrayList<>();
//        if (CollectionUtil.isNotEmpty(nodes)) {
//            nodeFloor = generateNodeFloor(nodes, edges, workMenuDto.getId().intValue());
//            if (CollectionUtil.isNotEmpty(nodeFloor)) {
//                Double poMaxX = 0.00;
//                Double y = 50.00;
//                Map map = new HashMap();
//                map.put("poMaxX", 0.00);
//                map.put("y", 50.00);
//                for (Integer i = 1; i < nodeFloor.size(); i++) {
//                    if (CollectionUtil.isEmpty(nodeFloor.get(i))) {
//                        continue;
//                    }
//                    map = fixedPosition(nodeFloor.get(i), i, Double.parseDouble(map.get("poMaxX").toString()), Double.parseDouble(map.get("y").toString()), workMenuDto.getId().intValue());
//                    rePoNodes.addAll(nodeFloor.get(i));
//                }
//                fixedPosition(nodeFloor.get(0), 0, Double.parseDouble(map.get("poMaxX").toString()), Double.parseDouble(map.get("y").toString()), workMenuDto.getId().intValue());
//                rePoNodes.addAll(nodeFloor.get(0));
//            }
//            jobLinkAndJobNodeVO.setNodes(rePoNodes);
//        } else {
//            jobLinkAndJobNodeVO.setNodes(nodes);
//        }
//
//        return R.okWithData(jobLinkAndJobNodeVO);
//    }
//
//    @ApiOperation("重新初始化所有节点的位置")
//    @GetMapping("/rePoXAndY")
//    public R rePoXAndY() {
//        List<WorkMenu> workMenus = iWorkMenuService.list(new QueryWrapper<WorkMenu>().eq("work_type", 3));
//        for (WorkMenu w : workMenus) {
//            WorkMenuVO workMenuVO = new WorkMenuVO();
//            BeanUtils.copyProperties(w, workMenuVO);
//            R r = reGenerageWorkFlow(workMenuVO);
//            JobLinkAndJobNodeVO jobLinkAndJobNodeVO = (JobLinkAndJobNodeVO) r.get("data");
//            if (null != jobLinkAndJobNodeVO) {
//                List<JobNodeInfoVO> nodes = jobLinkAndJobNodeVO.getNodes();
//                if (CollectionUtil.isEmpty(nodes)) {
//                    continue;
//                }
//                for (JobNodeInfoVO n : nodes) {
//                    JobNodeInfo jobNodeInfo = jobNodeInfoService.getById(n.getId());
//                    jobNodeInfo.setPosX(n.getPosX());
//                    jobNodeInfo.setPosY(n.getPosY());
//                    jobNodeInfoService.updateById(jobNodeInfo);
//                }
//            }
//
//        }
//        return R.ok();
//    }
//
//    /**
//     * 生成节点层级集合
//     *
//     * @param nodes
//     * @param edges
//     * @return
//     */
//    public List<List<JobNodeInfoVO>> generateNodeFloor(List<JobNodeInfoVO> nodes, List<JobLinkVO> edges, Integer workMenuId) {
//        List<List<JobNodeInfoVO>> nodeFloor = new ArrayList<>();
//        if (CollectionUtil.isNotEmpty(edges)) {
//            Set<Integer> dstNodeIds = JobLinkVO.getDstOrSrcNodeIds(edges, "dst");
//            Set<Integer> srcNodeIds = JobLinkVO.getDstOrSrcNodeIds(edges, "src");
//            Map<Integer, JobNodeInfoVO> jobNodeInfoVOMap = JobLinkVO.getNodeMap(nodes);
//            //第0阶层添加单独节点
//            List<JobNodeInfoVO> singleJobNodeInfoVOS = new ArrayList<>();
//            for (JobNodeInfoVO n : nodes) {
//                //0 放单独节点 1 第一层节点 ...
//                if (!dstNodeIds.contains(n.getId()) && !srcNodeIds.contains(n.getId())) {
//                    singleJobNodeInfoVOS.add(n);
//                } else {
//                    continue;
//                }
//            }
//            nodeFloor.add(singleJobNodeInfoVOS);
//            System.out.println("单独节点" + singleJobNodeInfoVOS);
//
//            //第1阶层添加开始节点
//            List<JobNodeInfoVO> startJobNodeInfoVOS = new ArrayList<>();
//            for (Integer s : srcNodeIds) {
//                if (!dstNodeIds.contains(s)) {
//                    startJobNodeInfoVOS.add(jobNodeInfoVOMap.get(s));
//                }
//            }
//            nodeFloor.add(startJobNodeInfoVOS);
//            System.out.println("开始节点" + startJobNodeInfoVOS);
//
//
//            //添加n+1层的节点 n>=1
//            for (JobNodeInfoVO j : startJobNodeInfoVOS) {
//                generateEveryFloorNodes(nodeFloor, 2, j, workMenuId);
//            }
//
//            return nodeFloor;
//        } else {
//            nodeFloor.add(nodes);
//            return nodeFloor;
//        }
//    }
//
//    /**
//     * 生成节点阶层
//     *
//     * @param nodeFloor
//     * @param num
//     * @param parentjobNodeInfoVO
//     * @param workMenuId
//     */
//    public void generateEveryFloorNodes(List<List<JobNodeInfoVO>> nodeFloor, Integer num, JobNodeInfoVO parentjobNodeInfoVO, Integer workMenuId) {
//        List<JobLink> jobLinks = jobLinkService.list(new QueryWrapper<JobLink>().eq("menu_id", Long.valueOf(workMenuId)).eq("linke_type", 0).eq("src_node_id", parentjobNodeInfoVO.getId()));
//        if (CollectionUtil.isNotEmpty(jobLinks)) {
//
//            //获取JobNodeInfoVO的所有子节点
//            Set<JobNodeInfo> sonNodeInfosSet = new HashSet<>();
//            List<JobNodeInfo> sonNodeInfos = new ArrayList<>();
//
//            for (JobLink j : jobLinks) {
//                JobNodeInfo jobNodeInfo = jobNodeInfoService.getById(j.getDstNodeId());
//                if (null != jobNodeInfo) {
//                    sonNodeInfosSet.add(jobNodeInfo);
//                }
//            }
//            sonNodeInfos.addAll(sonNodeInfosSet);
//            List<JobNodeInfoVO> nodes = PojoUtils.listConvert(JobNodeInfoVO.class, sonNodeInfos);
//
//
//            if (CollectionUtil.isNotEmpty(nodes)) {
//                //将子节点加入对应的阶层中
//                if (nodeFloor.size() <= num) {
//                    Integer addSize = num - nodeFloor.size() + 1;
//                    for (Integer i = 0; i < addSize; i++) {
//                        List<JobNodeInfoVO> list = new ArrayList<>();
//                        nodeFloor.add(list);
//                    }
//                }
//                changeNodeFloor(nodeFloor, nodes, num);
//                //查询每个子节点的子节点集合
//                for (JobNodeInfoVO j : nodes) {
//                    generateEveryFloorNodes(nodeFloor, num + 1, j, workMenuId);
//                }
//            }
//        }
//
//    }
//
//    /**
//     * 对满足条件的节点 改变其阶层，如果在加第3层时，有节点已存在于第二层，则删除第二层中该节点，并在第三层中加入他
//     *
//     * @param nodeFloor
//     * @param nodes
//     * @param currentFloor
//     */
//    public void changeNodeFloor(List<List<JobNodeInfoVO>> nodeFloor, List<JobNodeInfoVO> nodes, Integer currentFloor) {
//        if (CollectionUtil.isEmpty(nodeFloor) || CollectionUtil.isEmpty(nodes)) {
//            return;
//        }
//        //删除0~currentFloor 阶层中的nodes
//        for (int i = 0; i < currentFloor; i++) {
//            if (CollectionUtil.isEmpty(nodeFloor.get(i))) {
//                continue;
//            }
//            nodeFloor.get(i).removeAll(nodes);
//        }
//
//        //添加node到currentFloor 阶层中， 条件：在>currentFloor的阶层中如果存在node，就不添加node到currentFloor阶层中
//        for (int m = 0; m < nodes.size(); m++) {
//            System.out.println("处理" + currentFloor + "层的" + nodes.get(m).getId());
//            Boolean flag = true;
//            for (int i = currentFloor; i < nodeFloor.size(); i++) {
//                if (CollectionUtil.isEmpty(nodeFloor.get(i))) {
//                    continue;
//                }
//                if (nodeFloor.get(i).contains(nodes.get(m))) {
//                    System.out.println("在" + i + "层已经存在节点:" + nodes.get(m).getId());
//                    flag = false;
//                    break;
//                }
//            }
//            if (flag) {
//                nodeFloor.get(currentFloor).add(nodes.get(m));
//                System.out.println("添加成功");
//            }
//
//        }
//
//
//    }
//
//    public Boolean checkIsFitShortLink(List<JobNodeInfoVO> nodes, Integer workMenuId) {
//
//        Boolean isFit = true;
//        //记录父节点大于等于2的节点个数
//        Integer number = 0;
//        for (JobNodeInfoVO j : nodes) {
//            List<JobLink> jobLinks = jobLinkService.list(new QueryWrapper<JobLink>().eq("menu_id", Long.valueOf(workMenuId)).eq("linke_type", 0).eq("dst_node_id", j.getId()));
//            if (CollectionUtil.isNotEmpty(jobLinks) && jobLinks.size() >= 2) {
//                number++;
//            }
//        }
//        if (number > 2) {
//            isFit = false;
//        }
//        return isFit;
//    }
//
//    /**
//     * 确定每个节点的位置
//     *
//     * @param nodes
//     * @param floorNum
//     * @return
//     */
//    public Map<String, Double> fixedPosition(List<JobNodeInfoVO> nodes, Integer floorNum, Double poX2, Double y, Integer workMenuId) {
//        Map<String, Double> map = new HashMap<>();
//        if (!floorNum.equals(1)) {
//            if (nodes.size() <= 2 || checkIsFitShortLink(nodes, workMenuId)) {
//                y = y + 70.00;
//            } else {
//                y = y + 150.00;
//            }
//
//        }
//        map.put("y", y);
//        Double poX = 560.00;
//        Double poMaxX = poX2;
//        if (floorNum.equals(0)) {
//            System.out.println(poMaxX);
//            if (poMaxX >= 560) {
//                for (Integer i = 0; i < nodes.size(); i++) {
//                    nodes.get(i).setPosY(50.00 + i * 90.00);
//                    nodes.get(i).setPosX(poMaxX + 160.00);
//                }
//            } else {
//                for (Integer i = 0; i < nodes.size(); i++) {
//                    nodes.get(i).setPosY(50.00 + i * 90.00);
//                    nodes.get(i).setPosX(560.00);
//                }
//            }
//            map.put("poMaxX", poMaxX);
//            return map;
//        } else {
//            System.out.println(nodes.toString());
//            if (nodes.size() % 2 == 1) {
//                System.out.println(floorNum + "层共" + nodes.size());
//                //中间节点的下标
//                Integer midNum = (nodes.size() - 1) / 2;
//                for (Integer i = 0; i < nodes.size(); i++) {
//                    if (i <= midNum) {
//                        nodes.get(i).setPosY(y);
//                        nodes.get(i).setPosX(poX - (midNum - i) * 160.00);
//                    } else if (i > midNum) {
//                        nodes.get(i).setPosY(y);
//                        Double x = poX + (i - midNum) * 160.00;
//                        nodes.get(i).setPosX(x);
//                        if (x > poX2) {
//                            poMaxX = x;
//                            map.put("poMaxX", poMaxX);
//                        }
//                    }
//                }
//            } else {
//                System.out.println(floorNum + "层共" + nodes.size());
//                //中间两个节点中第一个节点的下标
//                Integer midNum = (nodes.size() - 1) / 2;
//                for (Integer i = 0; i < nodes.size(); i++) {
//                    if (i <= midNum) {
//                        System.out.println("" + y + " " + (poX - (midNum - i) * 160.00 - 80.00));
//                        nodes.get(i).setPosY(y);
//                        nodes.get(i).setPosX(poX - (midNum - i) * 160.00 - 80.00);
//                    } else if (i > midNum) {
//                        nodes.get(i).setPosY(y);
//                        Double x = poX + (i - midNum - 1) * 160.00 + 80.00;
//                        nodes.get(i).setPosX(x);
//                        System.out.println("" + y + " " + x);
//
//                        if (x > poX2) {
//                            poMaxX = x;
//                            map.put("poMaxX", poMaxX);
//
//                        }
//                    }
//                }
//            }
//            map.put("poMaxX", poMaxX);
//            return map;
//        }
//
////        if (CollectionUtil.isEmpty(jobLinkAndJobNodeVO.getEdges())){
////            if (CollectionUtil.isNotEmpty(jobLinkAndJobNodeVO.getNodes())){
////                for(JobNodeInfoVO n:jobLinkAndJobNodeVO.getNodes()){
////                    n.setPosX(poX.doubleValue());
////                    n.setPosY(poY.doubleValue());
////                    poY=poY+60;
////                }
////            }else{
////                return;
////            }
//    }

//        iWorkMenuService.listLinkedList(jobLinkAndJobNodeVO.getEdges(), null);


}

